package com.jdaw.algorithm.dac;

public class HanoiTower {
    public static void main(String[] args) {
        hanoiTower(6,'A','B','C');
    }

    public static void hanoiTower(int num,char a,char b,char c){
        if(num==1){
            System.out.println("第一个盘从"+a+"->"+c);
        }else{
            //把最上面的所有盘移到b
            hanoiTower(num-1,a,c,b);
            //最下面的盘移到c
            System.out.println("第"+num+"个盘从"+a+"->"+c);
            //所有的盘从b->c
            hanoiTower(num-1,b,a,c);
        }
    }
}
